﻿using System;
using System.Runtime.Serialization;
using System.ServiceModel;

namespace SecurityAgent
{
    [ServiceContract]    
    interface IObjectSecurityService
    {
        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        int GetObjectAuthorization(string applicationKey, string userToken, string objectName);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        ObjectClaim GetObjectClaim(string applicationKey, string userToken, string objectName, bool requireFieldLevel);
        
        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        bool IsObjectAuthorized(string applicationKey, string userToken, string objectName, int operation);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        [FaultContract(typeof(UnauthorizedAccessFault))]
        ObjectClaim[] GetAllObjects(string applicationKey, string userToken, bool requireFieldDetail);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        [FaultContract(typeof(UnauthorizedAccessFault))]
        ObjectClaim[] GetObjectsByCategory(string applicationKey, string userToken, string category, bool requireFieldDetail);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        [FaultContract(typeof(UnauthorizedAccessFault))]
        string GetObjectSettingValue(string applicationKey, string userToken, string objectName, string setting);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        [FaultContract(typeof(UnauthorizedAccessFault))]
        string GetObjectSettings(string applicationKey, string userToken, string objectName);

        [OperationContract]
        [FaultContract(typeof(SecurityFault))]
        [FaultContract(typeof(UnauthorizedAccessFault))]
        bool SetObjectSetting(string applicationKey, string userToken, string objectName, string setting, string value);
    }
}
